package chapter20;

import lombok.Data;

import java.io.Serializable;

/**
 * @Description: 矩形实体类
 * @Author: cqb
 * @Date: 2020/2/22 12:59
 */
@Data
public class Rectangle extends GeometricObject implements Serializable {
    private double width;
    private double height;

    public Rectangle(double width,double height){
        this.width=width;
        this.height=height;
    }

    @Override
    public double getArea() {
        return width * height;
    }

    @Override
    public double getPerimeter() {
        return 2 * (width + height);
    }
 }